<template>
    <div>
        <header>
            <slot name="header"></slot>
        </header>
        <!-- 插槽 -->
        <slot></slot>

        ===={{num}}

        <button @click="add">+</button>
    </div>
</template>

<script>
export default {
    props:['num'],
    created(){
        console.log(this.$parent.num)
    },
    data(){
        return {
            msg:'子组件'
        }
    },
    methods:{
        add(){
            this.$emit('addNum',5);
            this.$bus.$emit('change',this.msg)
        }
    }
}
</script>